<html>
<head><meta charset="utf-8"><title>using a custom codegen dll on windows · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html">using a custom codegen dll on windows</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244513217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244513217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244513217">(Jul 01 2021 at 02:57)</a>:</h4>
<p>Hello!</p>
<p>I wrote a custom codegen, compiled it to a dll, but rustc cant seem to be able to find/open it. I added the target dir to PATH, that did not work, i added it to an existing folder in PATH, that still did not work. I also tried using relative paths but that did not work either. Does rustc expect something else? im giving it the full path to my dll and its telling <code>The specified module could not be found. (os error 126)</code> :(</p>



<a name="244513700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244513700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244513700">(Jul 01 2021 at 03:09)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> i noticed the clif codegen does not support msvc, which is what i am using, does this perhaps have something to do with it? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="244517110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244517110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244517110">(Jul 01 2021 at 04:26)</a>:</h4>
<p>Im really not sure what's going on, i tried it with rust-gpu and it does not seem to work either. im guessing its some msvc thing :/</p>



<a name="244524588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244524588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244524588">(Jul 01 2021 at 06:40)</a>:</h4>
<p>The problem with cg_clif on msvc is simply that libstd on msvc uses native tls, which cranelift doesn't support yet for pe object files.</p>



<a name="244524657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244524657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244524657">(Jul 01 2021 at 06:41)</a>:</h4>
<p><span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span> Can you try passing the absolute path to the dll?</p>



<a name="244524721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244524721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244524721">(Jul 01 2021 at 06:42)</a>:</h4>
<p>tried that already and it didn't work</p>



<a name="244524734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244524734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244524734">(Jul 01 2021 at 06:42)</a>:</h4>
<p>with double backslashes or forward slashes, neither worked</p>



<a name="244524877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244524877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244524877">(Jul 01 2021 at 06:44)</a>:</h4>
<p>I can help you further then.</p>



<a name="244524925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244524925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244524925">(Jul 01 2021 at 06:45)</a>:</h4>
<p>i think maybe it could be a version mismatch, but im not hopeful</p>



<a name="244664359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244664359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244664359">(Jul 02 2021 at 06:40)</a>:</h4>
<p>so i finally figured it out, i cant believe i did not think of this, i am literally relying on libnvvm in my codegen, which is a dll, so how can it load the dll if it doesnt know where libnvvm is <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span> <a href="/user_uploads/4715/lBDSC7sGp5C-7JP_5mmrdN1Q/Screenshot_246.png">Screenshot_246.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/lBDSC7sGp5C-7JP_5mmrdN1Q/Screenshot_246.png" title="Screenshot_246.png"><img src="/user_uploads/4715/lBDSC7sGp5C-7JP_5mmrdN1Q/Screenshot_246.png"></a></div>



<a name="244664488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/using%20a%20custom%20codegen%20dll%20on%20windows/near/244664488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/using.20a.20custom.20codegen.20dll.20on.20windows.html#244664488">(Jul 02 2021 at 06:42)</a>:</h4>
<p>so i guess i have to edit PATH to include the libnvvm directory or something like that</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>